package com.test.thread.thread;

public class ThreadDemo {

    public static void main(String[] args) {

        Thread thread1 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("线程1");
            }
        });

        Thread thread2 = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    thread1.join();
                } catch (Exception e) {

                }
                System.out.println("线程2");
            }
        });

        Thread thread3 = new Thread(new Runnable() {

            @Override
            public void run() {
                try {
                    thread2.join();
                } catch (Exception e) {

                }
                System.out.println("线程3");
            }
        });

        //  for(int i=0;i<10;i++){

        thread1.start();
        thread2.start();
        thread3.start();

        //   }

    }
}
